//
// Created by LiuYou on 2021/5/7.
//

#ifndef HIGHPERFORMANCELINUXSERVERPROGRAMMING_LINUX_CLIENTDATA_HPP
#define HIGHPERFORMANCELINUXSERVERPROGRAMMING_LINUX_CLIENTDATA_HPP


#include <netinet/in.h>

namespace C {
    constexpr int getBufferSize() {
        return 64;
    }

    class ClientData {
    public:
        sockaddr_in sockAddrIn;
        char* writeBuffer;
        char buffer[getBufferSize()];
    public:
        const sockaddr_in& getSockAddrIn() const;

        void setSockAddrIn(const sockaddr_in& sockAddrIn);

        char* getWriteBuffer() const;

        void setWriteBuffer(char* writeBuffer);

        const char* getBuffer() const;

        char* getBuffer();
    };

    int setNonBlocking(int fd);
}


#endif //HIGHPERFORMANCELINUXSERVERPROGRAMMING_LINUX_CLIENTDATA_HPP
